/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Eyal
 */

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.bluetooth.*;

public class MyBluetooth implements DiscoveryListener {

    private DiscoveryAgent agent;
    private LocalDevice localDevice;
    
    public MyBluetooth(){
        try {
            localDevice = LocalDevice.getLocalDevice();
        } catch (BluetoothStateException ex) {
            Logger.getLogger(MyBluetooth.class.getName()).log(Level.SEVERE, null, ex);
        }
        agent = localDevice.getDiscoveryAgent();
    }
    
    public void inquiry() {
        try {
            agent.startInquiry(DiscoveryAgent.GIAC, this);
        } catch (BluetoothStateException ex) {
            Logger.getLogger(MyBluetooth.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    @Override
    public void deviceDiscovered(RemoteDevice rd, DeviceClass dc) {
        System.out.println("remote device: " + rd);
        System.out.println("remote device class: " + dc);
    }

    @Override
    public void servicesDiscovered(int i, ServiceRecord[] srs) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void serviceSearchCompleted(int i, int i1) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void inquiryCompleted(int i) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    
    
}
